From 2608f924e4f35ae59e84a29008a004e6fd53f909 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 1 May 2008 16:07:56 +0100 Subject: [PATCH] Intel vpid: Invalidate VPID mapping on INVLPG. Signed-off-by: Gianluca Guida --- xen/arch/x86/hvm/vmx/vmx.c | 3 ++- xen/include/asm-x86/hvm/vmx/vmx.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 33e105753c..387637b87c 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1368,7 +1368,8 @@ static void vmx_invlpg_intercept(unsigned long vaddr) { struct vcpu *curr = current; HVMTRACE_2D(INVLPG, curr, /*invlpga=*/ 0, vaddr); - paging_invlpg(curr, vaddr); + if ( paging_invlpg(curr, vaddr) ) + vpid_sync_vcpu_gva(curr, vaddr); } #define CASE_SET_REG(REG, reg) \ diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index 58834e7f7d..b7681f0e29 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -301,6 +301,12 @@ static inline void ept_sync_all(void) void ept_sync_domain(struct domain *d); +static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva) +{ + if ( cpu_has_vmx_vpid ) + __invvpid(0, v->arch.hvm_vmx.vpid, (u64)gva); +} + static inline void vpid_sync_vcpu_all(struct vcpu *v) { if ( cpu_has_vmx_vpid ) -- 2.30.2